<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateVideoLibrariesTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('video_libraries', function (Blueprint $table) {
            $table->id();
            $table->integer('category_id')->index()->default(0)->comment('分类id');
            $table->string('name')->comment('名称');
            $table->bigInteger('total_size')->default(0)->index()->comment('文件大小,kb');
            $table->bigInteger('total_second')->default(0)->index()->comment('总秒数');
            $table->string('video_format')->index()->comment('视频格式');
            $table->text('video_url')->comment('视频链接');
            $table->text('file_path')->nullable()->comment('文件路径');
            $table->string('file_driver')->index()->nullable()->comment('文件驱动');
            $table->string('thumb')->nullable()->comment('视频封面');
            $table->string('video_md5')->nullable()->comment('文件md5，用于上传时过滤相同文件');
            $table->timestamps();
        });

        DB::statement("ALTER TABLE video_libraries comment '视频库'");
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('video_libraries');
    }
}
